package com.project.easy.common.framework.auth.core.impl.memory;

import  com.project.easy.common.util.dto.UserInfo;
import com.project.easy.common.framework.auth.core.IQueryUser;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author GreatorMan.cool
 * @copyright: Copyright (c) 2020
 * @company: 扬起科技有限公司
 * @date 2021/11/1 21:44
 * @description: 内存用户
 */
public class MemoryQueryUser implements IQueryUser {

    /**
     * 内存用户
     */
    private static final Map<String, UserInfo> USER_MAP = new ConcurrentHashMap<>();
    /**
     * 初始化用户
     */
    static  {
        USER_MAP.put("admin", new UserInfo("超级管理员", "admin", 10000L, "yqkj2022"));
        USER_MAP.put("yc", new UserInfo("超级管理员", "yc", 10000L, "yqkjYc2022"));
    }


    @Override
    public UserInfo userInfo(String acc) {
        if (USER_MAP.containsKey(acc)) {
            return USER_MAP.get(acc);
        }
        return null;
    }

    @Override
    public int getOrder() {
        return 0;
    }
}
